Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MongoDB to use lean() #999

Merged
merged 2 commits into from
Mar 16, 2021
Merged

Conversation

jason-fox
Copy link
Contributor

As the mongoose docs state:

Lean is great for high-performance, read-only cases,

@jason-fox
Copy link
Contributor Author

Extraction of lean() from #926 but without the redis or memory cache

@@ -188,26 +188,11 @@ function listDevices(type, service, subservice, limit, offset, callback) {
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR should include an entry in CHANGES_NEXT_RELEASE file describing the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 39c7874

for (let i = 0; i < attributes.length; i++) {
if (body[attributes[i]] !== undefined) {
group[attributes[i]] = body[attributes[i]];
attributeList.forEach((key) => {
Copy link
Member

@AlvaroVega AlvaroVega Mar 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until this resource was not able to be updated. With this resource could be updated. Not sure if is desirable.

Copy link
Contributor Author

@jason-fox jason-fox Mar 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really want separately maintained lists for create and update, at least bring these out as constants at the head of the file. The current position where they are buried in the middle of the file means that they are more likely to get out of sync. Difficult to decide if this is a deliberate decision or someone missed an entry in a list.

It also means a new array is created and destroyed for every update. I'm happy to re-alter the functionality here, but I'd like a clear and definite plan.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apikey and resource are keys to updae and delete a device group.
Sometime ago apikey and resource where not able to be modified. Currently apikey could be modified, so I don't see a reason to resource couldn't be modified.

Copy link
Member

@AlvaroVega AlvaroVega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@fgalan fgalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fgalan fgalan merged commit e20f38c into telefonicaid:master Mar 16, 2021
@jason-fox jason-fox deleted the feature/lean branch March 16, 2021 12:50
@AlvaroVega AlvaroVega mentioned this pull request May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants